#pragma once

#include <unordered_map>
#include "../share/user_define.h"
#include "../../3rd/libjson/json.h"

/*
"diamond_coin": 2.0,
"hero_soul1": [1,10],
"soul1_num": [[106000300,1,100]],
"hero_soul2": [1,10],
"soul2_num": [[106000200,1,100]],
"hero_card1": [1,10],
"card1_num": [[107000300,1,100]],
"hero_card2": [1,10],
"card2_num": [[107000200,1,100]],
"blue_prop": [1,10],
"blue_num": [[102000100,1,50],[103000100,1,50]],
"green_prop": [1,10],
"green_num": [[102000300,1,50],[103000300,1,50]],
"exp_prop": [1,10],
"exp_num": [[105000200,1,100]],
"gold_num": [[104000200,1,100]],
"buy_consume": 288.0,
"give_exp": [105000100,1]
*/

struct UInt32_3x
{
	uint32_t mValue[3];
};

struct GoldDraw
{
	uint32_t mId;
	uint32_t mHeroSoul1[2];
	std::vector<UInt32_3x> mSoulNum1;
	uint32_t mHeroSoul2[2];
	std::vector<UInt32_3x> mSoulNum2;
	uint32_t mHeroCard1[2];
	std::vector<UInt32_3x> mCardNum1;
	uint32_t mHeroCard2[2];
	std::vector<UInt32_3x> mCardNum2;
	uint32_t mBlueProp[2];
	std::vector<UInt32_3x> mBlueNum;
	uint32_t mGreenProp[2];
	std::vector<UInt32_3x> mGreenNum;
	uint32_t mExpProp[2];
	std::vector<UInt32_3x> mExpNum;
	std::vector<UInt32_3x> mGoldNum;
	uint32_t mBuyConsume;
	uint32_t mGiveExp[2];

	GoldDraw()
	{
		Clear();
	}

	void Clear(void)
	{

	}
};

class GoldDrawCacheData
{
public:

	static void CreateInstance(void);
	static GoldDrawCacheData* GetInstance(void);

	~GoldDrawCacheData(void);

public:

	bool Initialization(void);

	bool Reload(void);

	GoldDraw* GetData(uint32_t id);

	bool GetDataJsonString(uint32_t id, Json::Value& _jm);

	uint32_t GetDataCount(void);

private:
	GoldDrawCacheData(void);

	void Clear(void);

	void AddData(uint32_t id, Json::Value& jm);

private:

	static GoldDrawCacheData* mInstance;

	std::unordered_map<uint32_t, GoldDraw*> m_mapCacheData;
	uint32_t m_maxCount;

};